#ifndef __MEMENTO_H__
#define __MEMENTO_H__

#include <iostream>

/// @brief 角色状态备忘录类
class RoleStateMemento
{
public:
    int m_HP{};  // 血量
    int m_DP{};  // 防御力
    int m_ATK{}; // 攻击力
public:
    RoleStateMemento(int HP, int DP, int ATK)
        : m_HP(HP), m_DP(DP), m_ATK(ATK)
    {
    }
};

/// @brief 备忘录管理类
class MementoManager
{
public:
    RoleStateMemento *m_memen{};
};

/// @brief 游戏角色类
class GameRole
{
private:
    int m_HP{};  // 血量
    int m_DP{};  // 防御力
    int m_ATK{}; // 攻击力
public:
    GameRole(int HP, int DP, int ATK)
        : m_HP(HP), m_DP(DP), m_ATK(ATK)
    {
    }
    /// @brief 保存状态
    /// @return 返回状态备忘录指针
    RoleStateMemento *SaveState()
    {
        return new RoleStateMemento(m_HP, m_DP, m_ATK);
    }
    /// @brief 恢复状态
    /// @param m 要恢复为的备忘录指针
    void RecoveryState(RoleStateMemento m)
    {
        m_HP = m.m_HP;
        m_DP = m.m_DP;
        m_ATK = m.m_ATK;
    }
    /// @brief 战斗
    void Combat()
    {
        m_HP = 0;
        m_DP = 0;
        m_ATK = 0;
    }
    void ShowState()
    {
        printf("血量【%d】\n防御力【%d】\n攻击力【%d】\n", m_HP, m_DP, m_ATK);
    }
};

#endif